package com.yy.controller;

import com.yy.domain.ResponseResult;
import com.yy.dto.mother.*;
import com.yy.service.MotherChildrenService;
import com.yy.vo.*;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import java.util.List;

@RestController
@RequestMapping("/api/v1/mother-children")
@Api(tags = "华西附二院相关接口")
public class MotherChildrenController {

    private final MotherChildrenService motherChildrenService;

    public MotherChildrenController(MotherChildrenService motherChildrenService) {
        this.motherChildrenService = motherChildrenService;
    }

    @GetMapping("/get-authcode")
    @ApiOperation(value = "获取手机验证码")
    public ResponseResult<AuthDataDTO> getAuthCode(
            @ApiParam(value = "手机号码", required = true)
            @RequestParam String phoneNum) {
        return new ResponseResult<>(200, "请求成功", motherChildrenService.getAuthCode(phoneNum));
    }

    @PostMapping("/login")
    @ApiOperation(value = "微信小程序登录")
    public ResponseResult<LoginResponseDataDTO> login(@RequestBody WeChatLoginVO weChatLoginVO) {
        return new ResponseResult<>(200, "请求成功", motherChildrenService.login(weChatLoginVO));
    }

    @PostMapping("/user-organ-cards")
    @ApiOperation(value = "获取用户的机构卡片列表")
    public ResponseResult<List<UserOrganCardDetailDTO>> getUserOrganCardList(@RequestBody CardRequestVO cardRequestVO) {
        return new ResponseResult<>(200, "请求成功", motherChildrenService.getUserOrganCardList(cardRequestVO));
    }

    @PostMapping("/sel-tree")
    @ApiOperation(value = "科室预约分类树")
    public ResponseResult<DepartmentInfoDTO> selTree(@RequestBody TreeRequestVO treeRequestVO) {
        return new ResponseResult<>(200, "请求成功", motherChildrenService.selTree(treeRequestVO));
    }

    @PostMapping("/sel-doc-list")
    @ApiOperation(value = "预约医生选择列表接口")
    public ResponseResult<DetailedDataResponseDTO> selDocListSelectionPage(@RequestBody TreeRequestVO treeRequestVO) {
        return new ResponseResult<>(200, "请求成功", motherChildrenService.selDocListSelectionPage(treeRequestVO));
    }

    @PostMapping("/sel-doctor-list")
    @ApiOperation(value = "预约医生分页列表接口")
    public ResponseResult<PageDoctorResponseDTO> selDoctorListPaging(@RequestBody DoctorRequestVO doctorRequestVO) {
        return new ResponseResult<>(200, "请求成功", motherChildrenService.selDoctorListPaging(doctorRequestVO));
    }

    @PostMapping("/sel-doctor-schedule")
    @ApiOperation(value = "预约医生日程查询接口")
    public ResponseResult<DataResponseDTO> selDoctorSchedule(@RequestBody DoctorInfoRequestVO doctorInfoRequestVO) {
        return new ResponseResult<>(200, "请求成功", motherChildrenService.selDoctorSchedule(doctorInfoRequestVO));
    }

    @PostMapping("/sel-sure-order")
    @ApiOperation(value = "预约确认订单页面接口")
    public ResponseResult<DoctorDetailDTO> selSureOrderPage(@RequestBody ScheduleInfoRequestVO scheduleInfoRequestVO) {
        return new ResponseResult<>(200, "请求成功", motherChildrenService.selSureOrderPage(scheduleInfoRequestVO));
    }

    @PostMapping("/order-check")
    @ApiOperation(value = "预约订单检查接口")
    public ResponseResult<AppointmentResponseDTO> orderCheck(@RequestBody AppointmentRequestVO appointmentRequestVO) {
        return new ResponseResult<>(200, "请求成功", motherChildrenService.orderCheck(appointmentRequestVO));
    }

    @PostMapping("/get-image-code")
    @ApiOperation(value = "获取图像验证码接口")
    public ResponseResult<ImageCodeDTO> getImageCode(@RequestBody ImageRequestVO imageRequestVO) {
        return new ResponseResult<>(200, "请求成功", motherChildrenService.getImageCode(imageRequestVO));
    }

    @PostMapping("/sure-order")
    @ApiOperation(value = "确认订单")
    public ResponseResult<DetailResponseDTO> sureOrder(@RequestBody InformationVO informationVO) {
        return new ResponseResult<>(200, "请求成功", motherChildrenService.sureOrder(informationVO));
    }

    @PostMapping("/record-page")
    @ApiOperation(value = "挂号记录")
    public ResponseResult<PatientPageInfoDTO> recordPage(@RequestBody QueryCriteriaVO queryCriteriaVO) {
        return new ResponseResult<>(200, "请求成功", motherChildrenService.recordPage(queryCriteriaVO));
    }

    @PostMapping("/cancel")
    @ApiOperation(value = "取消订单")
    public ResponseResult<Void> cancel(@RequestBody CancelVO cancelVO) {
        motherChildrenService.cancel(cancelVO);
        return new ResponseResult<>(200, "请求成功");
    }

}
